// custom-tab-bar/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    allList: [
      //医生
      [{
        "pagePath": "pages/servicelIst/index",
        "text": "项目列表",
        "iconPath": "../../assets/image/tarbar/home.png",
        "selectedIconPath": "../../assets/image/tarbar/homed.png"
      }],
      //患者
      [{
          "pagePath": "pagesDoctor/docterIndex/index",
          "text": "项目列表",
          "iconPath": "../../assets/image/tarbar/home.png",
          "selectedIconPath": "../../assets/image/tarbar/homed.png"
        },
        {
          "pagePath": "pages/orderList/index",
          "text": "订单列表",
          "iconPath": "../../assets/image/tarbar/message.png",
          "selectedIconPath": "../../assets/image/tarbar/messaged.png"
        },
        {
          "pagePath": "pages/user/index",
          "text": "我的",
          "iconPath": "../../assets/image/tarbar/user.png",
          "selectedIconPath": "../../assets/image/tarbar/usered.png"
        }
      ]
    ],
    selectList: [],
  },
  /**
   * 生命周期的方法：当组件被加载的时候调用
   */
  attached() {
    if (wx.getStorageSync('loginType') == "doctor") {
      this.setData({
        selectList: this.data.allList[0]
      })
    } else {
      this.setData({
        selectList: this.data.allList[1]
      })
    }



  },
  /**
   * 组件的方法列表
   */
  methods: {
    swichTo(e) {
      //console.dir(e);
      let path = e.currentTarget.dataset.path;
      let selected = e.currentTarget.dataset.selected;

      wx.switchTab({
        url: path,
      })
    }
  }
})